using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using Domain.Entidades;
using System.ComponentModel.DataAnnotations.Schema;

namespace Data.Models.Mapping
{
    public class VW_tipo_email_envio_usuarioMap : EntityTypeConfiguration<VW_tipo_email_envio_usuario>
    {
        public VW_tipo_email_envio_usuarioMap()
        {
            // Primary Key
            this.HasKey(t => new { t.tip_codigo, t.mod_descricao, t.usu_codigo, t.sta_codigo, t.uni_codigo, t.set_codigo });

            // Properties
            this.Property(t => t.tip_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.tip_descricao)
                .HasMaxLength(70);

            this.Property(t => t.mod_descricao)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.usu_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.usu_nome)
                .HasMaxLength(100);

            this.Property(t => t.usu_login)
                .HasMaxLength(100);

            this.Property(t => t.sta_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.uni_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.usu_email)
                .HasMaxLength(70);

            this.Property(t => t.set_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("VW_tipo_email_envio_usuario");
            this.Property(t => t.tip_codigo).HasColumnName("tip_codigo");
            this.Property(t => t.tip_descricao).HasColumnName("tip_descricao");
            this.Property(t => t.mod_codigo).HasColumnName("mod_codigo");
            this.Property(t => t.mod_descricao).HasColumnName("mod_descricao");
            this.Property(t => t.usu_codigo).HasColumnName("usu_codigo");
            this.Property(t => t.usu_nome).HasColumnName("usu_nome");
            this.Property(t => t.usu_login).HasColumnName("usu_login");
            this.Property(t => t.sta_codigo).HasColumnName("sta_codigo");
            this.Property(t => t.uni_codigo).HasColumnName("uni_codigo");
            this.Property(t => t.usu_email).HasColumnName("usu_email");
            this.Property(t => t.set_codigo).HasColumnName("set_codigo");
        }
    }
}
